spark = SparkSession.builder.appName("BasicDataFrameOperations").getOrCreate()  
  
# 读取CSV文件到DataFrame  
# 替换"path/to/sales_data.csv"为你的CSV文件实际路径  
sales_data_df = spark.read.format("csv")\  
                        .option("header", "true")\  
                        .load("path/to/sales_data.csv")  
                          
sales_data_df.show(5) 